import instance from '../utils/request'

const getArticle = ({ id }) => {
  return instance({
    method: 'get',
    url: '/v1_0/articles/' + id
  })
}

const followUser = ({ target }) => {
  return instance({
    method: 'post',
    url: '/v1_0/user/followings',
    data: {
      target
    }
  })
}

const unFollowUser = ({ target }) => {
  return instance({
    method: 'delete',
    url: '/v1_0/user/followings/' + target
  })
}

const getLikings = ({ target }) => {
  return instance({
    method: 'post',
    url: '/v1_0/article/likings',
    data: {
      target
    }
  })
}

const removeLikings = ({ target }) => {
  return instance({
    method: 'delete',
    url: '/v1_0/article/likings/' + target
  })
}

const getDislikes = ({ target }) => {
  return instance({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target
    }
  })
}

const removeDislikes = ({ target }) => {
  return instance({
    method: 'delete',
    url: '/v1_0/article/dislikes/' + target
  })
}

export {
  getArticle,
  followUser,
  unFollowUser,
  getLikings,
  removeLikings,
  getDislikes,
  removeDislikes
}
